package BanyuanClub.Study.Day0310.通讯;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Scanner;

public class Server {
    public static void main(String[] args) throws IOException {
        ServerSocket server = new ServerSocket(12345);
        Scanner in = new Scanner(System.in);
        System.out.println("服务器已启动");
        Socket socket = server.accept();
        System.out.println("已链接客户端");
        BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        PrintWriter pw = new PrintWriter(socket.getOutputStream(),true);
        pw.println(in.next());
        String s = br.readLine();
        System.out.println(s);
    }
}
